package com.ninetaildemonfox.zdl.socialproject.mvp.ui.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;

import com.ninetaildemonfox.zdl.ninetaildemonfox.base.BaseFragment;

import java.util.List;

/**
 * 创建人： Nine tails fox
 * 创建时间： 2019/7/22
 * 功能描述：
 * 联系方式：1037438704@qq.com
 *
 * @author NineTailDemonFox
 */

public class PagerFragmentAdapter extends FragmentStatePagerAdapter {
    private List<Fragment> mFragmentList;
    private String[] TITLE;


    public PagerFragmentAdapter(FragmentManager fm) {
        super(fm);
    }

    public PagerFragmentAdapter(FragmentManager fm, List<Fragment> mFragmentList, String[] TITLE) {
        super(fm);
        this.mFragmentList = mFragmentList;
        this.TITLE = TITLE;
    }

    @Override
    public int getCount() {
        return mFragmentList.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return TITLE[position % TITLE.length];
    }

    @Override
    public int getItemPosition(Object object) {
        return POSITION_NONE;
    }

    @Override
    public Fragment getItem(int position) {
        return mFragmentList.get(position);
    }
}